The SRLT builds on established reversal paradigms (Costa et al., 2015; Dombrovski et al., 2010). In this task, participants select between two random stimuli in three 80-trial blocks, for a total of 240 trials. After participants make their choice, feedback appears on the screen related to whether their choice was correct or incorrect (Figure 1). Each block is made up of an acquisition and reversal for three separate stimulus pairings. In the initial acquisition phase, a given stimulus is associated with “correct” feedback 80% and “incorrect” feedback 20% of the time, while the other is incorrect feedback 80% and correct feedback 20% of the time. In the reversal phase, contingencies are reversed such that the previously predominantly rewarding stimulus is now the less rewarding option. Participants learn these contingencies about the same two stimuli for one acquisition and one reversal phase before two new stimuli are presented. Data for this task were collected using the stimulus presentation software Inquisit.
The current cleaning code is housed in the Tidy_functions_PUBS script: refer to these functions for any questions about data cleaning. For any questions related to the definition of task variables, refer to: https://docs.google.com/spreadsheets/d/1V2UD28C_zAfH90BnNO3si6c0-qDUDFbHoU44rfdEt4I/edit#gid=1309555968.
Load Pilot Data…
knitr::opts_chunk$set(message = FALSE)
options(knitr.duplicate.label = "allow")
##Load Packages and source scripts
pacman::p_load(tidyverse, readr, janitor, ggplot2,wesanderson, cowplot, flextable, plotly, emmeans, data.table)
setwd("~/github_repos/ReversalTask/Analysis/")
source("Tidy_functions_PUBS.R")
#reversal_data_8.16 <- data.table::fread("~/github_repos/ReversalTask/Reversal_pilot_mTurk.csv", fill = TRUE)
#load data
#load("Reversal_Task_Cleaned.Rdata")
reversal_data <- data.table::fread("~/github_repos/ReversalTask/Data/Reversal_Task_2.18.2021.csv", fill = TRUE, stringsAsFactors = FALSE) %>% group_by(subject, time) %>% filter(!subject %in% c(324215, 1))
reversal_data <- reversal_data %>% mutate(subject = ifelse(time == "18:47:13", 456, subject))
subjects <- unique(reversal_data$subject)
summary <- "by_phase" #by_block, by_phase, by_block_phase
Clean and transform Data. Perform basic checks….
trim_cols <- TRUE
reversal_data <- data.frame(lapply(reversal_data, function(x) gsub(",", ".", x, fixed = TRUE)))
reversal <- tidy_reversal(reversal_data)
## Warning in if (as.Date(data$date) < "2021-08-31") {: the condition has length >
## 1 and only the first element will be used
## Warning in if (as.Date(data$date) > "2021-08-31") {: the condition has length >
## 1 and only the first element will be used
#check_tidy(reversal)
colsToConvert <- c("totalcorrect", "consecutivecorrect", "reversalnumber", "totalearnings",
"trial_number", "total_trialnum", "numbercorrectfeedback", "numbercorrectfeedback_block",
"centsearned", "trial.choice.latency", "block_number")
reversal <- reversal[, (colsToConvert) := lapply(.SD, as.character), .SDcols = colsToConvert]
reversal <- reversal[, (colsToConvert) := lapply(.SD, as.numeric), .SDcols = colsToConvert]
sapply(reversal, class)
## subject
## "character"
## date
## "character"
## time
## "character"
## trialcode
## "character"
## blockcode
## "character"
## stimulusitem1
## "character"
## trial.choice.percentcorrect
## "character"
## trial.choice.latency
## "numeric"
## trial.choice.response
## "character"
## picture.correctStim.currentvalue
## "character"
## picture.incorrectStim.currentvalue
## "character"
## block_number
## "numeric"
## task_phase
## "character"
## index_correctChoice
## "character"
## index_incorrectChoice
## "character"
## correctChoicePosition
## "character"
## rightleftcorrect
## "character"
## correctKey
## "character"
## incorrectKey
## "character"
## percentTrialsCorrectFeedback_correctStim
## "character"
## percentTrialsCorrectFeedback_incorrectStim
## "character"
## responseAndFeedbackCategory
## "character"
## isThisTrialPractice
## "character"
## isResponseCorrect
## "character"
## isFeedbackAccurate
## "character"
## trial_number
## "numeric"
## total_trialnum
## "numeric"
## numbercorrectfeedback
## "numeric"
## numbercorrectfeedback_block
## "numeric"
## totalcorrect
## "numeric"
## consecutivecorrect
## "numeric"
## reversalnumber
## "numeric"
## totalearnings
## "numeric"
## centsearned
## "numeric"
## correctstim_name
## "character"
# bad <- c()
# for(i in 1:nrow(check_tidy)){
# if(count > 1){
# bad[nrow(check_tidy)] <- i
# }
# }
Generating results summary…
Table 1. Performance statistics were calculated by block (1-4), and/or phase (acquisition or reversal). Problematic rows are highlighted yellow.
In summary, all participants learned the task remarkably quickly. They all cleared the first criterion of making at least 10 “correct choices” per block (reached_criterion). Data were flagged as “Below Threshold” if participants chose the “correct” option less than 50% of the time in any given phase (percent_correct).
subject | task_phase | avg_latency | reached_criterion | NumberofTrials | NumberCorrect | percent_correct | above_threshold |
100832 | Acquisiton | 421.93396 | 8.000000 | 106.0000 | 89.00000 | 0.8396226 | Above |
100832 | Reversal | 400.37234 | 11.000000 | 94.0000 | 49.00000 | 0.5212766 | Above |
103852 | Acquisiton | 392.14286 | 8.000000 | 112.0000 | 103.00000 | 0.9196429 | Above |
103852 | Reversal | 395.25000 | 10.000000 | 88.0000 | 66.00000 | 0.7500000 | Above |
104587 | Acquisiton | 543.29245 | 8.000000 | 106.0000 | 72.00000 | 0.6792453 | Above |
104587 | Reversal | 493.94681 | 9.000000 | 94.0000 | 64.00000 | 0.6808511 | Above |
109992 | Acquisiton | 773.85981 | 8.000000 | 107.0000 | 71.00000 | 0.6635514 | Above |
109992 | Reversal | 694.27957 | 10.000000 | 93.0000 | 65.00000 | 0.6989247 | Above |
117568 | Acquisiton | 423.42857 | 9.000000 | 112.0000 | 66.00000 | 0.5892857 | Above |
117568 | Reversal | 383.29213 | 10.000000 | 89.0000 | 65.00000 | 0.7303371 | Above |
121014 | Acquisiton | 307.82178 | 9.000000 | 101.0000 | 58.00000 | 0.5742574 | Above |
121014 | Reversal | 349.76768 | 9.000000 | 99.0000 | 72.00000 | 0.7272727 | Above |
127306 | Acquisiton | 446.83333 | 8.000000 | 90.0000 | 64.00000 | 0.7111111 | Above |
127306 | Reversal | 414.01818 | 10.000000 | 110.0000 | 79.00000 | 0.7181818 | Above |
130195 | Acquisiton | 437.83505 | 9.000000 | 97.0000 | 68.00000 | 0.7010309 | Above |
130195 | Reversal | 404.32039 | 8.000000 | 103.0000 | 71.00000 | 0.6893204 | Above |
131111 | Acquisiton | 474.10000 | 8.000000 | 100.0000 | 79.00000 | 0.7900000 | Above |
131111 | Reversal | 433.81000 | 10.000000 | 100.0000 | 84.00000 | 0.8400000 | Above |
132548 | Acquisiton | 588.82524 | 10.000000 | 103.0000 | 66.00000 | 0.6407767 | Above |
132548 | Reversal | 486.60825 | 8.000000 | 97.0000 | 81.00000 | 0.8350515 | Above |
132661 | Acquisiton | 241.41346 | 11.000000 | 104.0000 | 67.00000 | 0.6442308 | Above |
132661 | Reversal | 173.59375 | 14.000000 | 96.0000 | 51.00000 | 0.5312500 | Above |
135045 | Acquisiton | 470.18584 | 8.000000 | 113.0000 | 75.00000 | 0.6637168 | Above |
135045 | Reversal | 486.35632 | 9.000000 | 87.0000 | 55.00000 | 0.6321839 | Above |
140724 | Acquisiton | 188.87500 | 17.000000 | 96.0000 | 32.00000 | 0.3333333 | Below |
140724 | Reversal | 178.25962 | 11.000000 | 104.0000 | 57.00000 | 0.5480769 | Above |
143811 | Acquisiton | 419.89773 | 8.000000 | 88.0000 | 82.00000 | 0.9318182 | Above |
143811 | Reversal | 389.41071 | 10.000000 | 112.0000 | 78.00000 | 0.6964286 | Above |
153044 | Acquisiton | 466.85714 | 8.000000 | 91.0000 | 69.00000 | 0.7582418 | Above |
153044 | Reversal | 415.41284 | 11.000000 | 109.0000 | 74.00000 | 0.6788991 | Above |
163496 | Acquisiton | 692.08696 | 9.000000 | 92.0000 | 70.00000 | 0.7608696 | Above |
163496 | Reversal | 692.14815 | 15.000000 | 108.0000 | 44.00000 | 0.4074074 | Below |
165303 | Acquisiton | 697.12903 | 8.000000 | 93.0000 | 51.00000 | 0.5483871 | Above |
165303 | Reversal | 653.35514 | 13.000000 | 107.0000 | 55.00000 | 0.5140187 | Above |
182588 | Acquisiton | 554.98058 | 8.000000 | 103.0000 | 64.00000 | 0.6213592 | Above |
182588 | Reversal | 499.87629 | 8.000000 | 97.0000 | 65.00000 | 0.6701031 | Above |
186071 | Acquisiton | 555.57944 | 9.000000 | 107.0000 | 88.00000 | 0.8224299 | Above |
186071 | Reversal | 462.26882 | 8.000000 | 93.0000 | 51.00000 | 0.5483871 | Above |
188470 | Acquisiton | 348.69811 | 8.000000 | 106.0000 | 69.00000 | 0.6509434 | Above |
188470 | Reversal | 358.17021 | 9.000000 | 94.0000 | 56.00000 | 0.5957447 | Above |
190335 | Acquisiton | 296.13333 | 8.000000 | 90.0000 | 52.00000 | 0.5777778 | Above |
190335 | Reversal | 151.10909 | 12.000000 | 110.0000 | 52.00000 | 0.4727273 | Below |
219128 | Acquisiton | 410.45192 | 8.000000 | 104.0000 | 78.00000 | 0.7500000 | Above |
219128 | Reversal | 365.56250 | 8.000000 | 96.0000 | 82.00000 | 0.8541667 | Above |
224761 | Acquisiton | 592.91489 | 10.000000 | 94.0000 | 60.00000 | 0.6382979 | Above |
224761 | Reversal | 507.44340 | 9.000000 | 106.0000 | 77.00000 | 0.7264151 | Above |
225033 | Acquisiton | 99.65979 | 14.000000 | 97.0000 | 43.00000 | 0.4432990 | Below |
225033 | Reversal | 98.08738 | 12.000000 | 103.0000 | 56.00000 | 0.5436893 | Above |
227403 | Acquisiton | 610.34906 | 10.000000 | 106.0000 | 61.00000 | 0.5754717 | Above |
227403 | Reversal | 404.92553 | 10.000000 | 94.0000 | 63.00000 | 0.6702128 | Above |
227459 | Acquisiton | 475.56731 | 9.000000 | 104.0000 | 83.00000 | 0.7980769 | Above |
227459 | Reversal | 384.48958 | 8.000000 | 96.0000 | 60.00000 | 0.6250000 | Above |
227781 | Acquisiton | 370.58511 | 9.000000 | 94.0000 | 65.00000 | 0.6914894 | Above |
227781 | Reversal | 268.64151 | 11.000000 | 106.0000 | 58.00000 | 0.5471698 | Above |
237706 | Acquisiton | 501.56667 | 12.000000 | 90.0000 | 54.00000 | 0.6000000 | Above |
237706 | Reversal | 470.04545 | 10.000000 | 110.0000 | 62.00000 | 0.5636364 | Above |
239619 | Acquisiton | 784.20652 | 8.000000 | 92.0000 | 70.00000 | 0.7608696 | Above |
239619 | Reversal | 780.36111 | 8.000000 | 108.0000 | 71.00000 | 0.6574074 | Above |
242905 | Acquisiton | 563.87255 | 12.000000 | 102.0000 | 59.00000 | 0.5784314 | Above |
242905 | Reversal | 540.08163 | 10.000000 | 98.0000 | 64.00000 | 0.6530612 | Above |
250866 | Acquisiton | 364.43011 | 14.000000 | 93.0000 | 48.00000 | 0.5161290 | Above |
250866 | Reversal | 184.53271 | 11.000000 | 107.0000 | 56.00000 | 0.5233645 | Above |
270470 | Acquisiton | 56.74257 | 8.000000 | 101.0000 | 58.00000 | 0.5742574 | Above |
270470 | Reversal | 58.77778 | 11.000000 | 99.0000 | 56.00000 | 0.5656566 | Above |
271259 | Acquisiton | 467.04673 | 8.000000 | 107.0000 | 85.00000 | 0.7943925 | Above |
271259 | Reversal | 493.48387 | 8.000000 | 93.0000 | 66.00000 | 0.7096774 | Above |
277035 | Acquisiton | 159.94000 | 8.000000 | 100.0000 | 56.00000 | 0.5600000 | Above |
277035 | Reversal | 148.64000 | 12.000000 | 100.0000 | 45.00000 | 0.4500000 | Below |
277755 | Acquisiton | 196.42574 | 12.000000 | 101.0000 | 46.00000 | 0.4554455 | Below |
277755 | Reversal | 192.32323 | 10.000000 | 99.0000 | 54.00000 | 0.5454545 | Above |
278764 | Acquisiton | 506.27723 | 10.000000 | 101.0000 | 56.00000 | 0.5544554 | Above |
278764 | Reversal | 498.17172 | 12.000000 | 99.0000 | 45.00000 | 0.4545455 | Below |
280385 | Acquisiton | 443.60440 | 8.000000 | 91.0000 | 75.00000 | 0.8241758 | Above |
280385 | Reversal | 411.66972 | 17.000000 | 109.0000 | 38.00000 | 0.3486239 | Below |
286380 | Acquisiton | 580.64356 | 12.000000 | 101.0000 | 68.00000 | 0.6732673 | Above |
286380 | Reversal | 507.43434 | 9.000000 | 99.0000 | 57.00000 | 0.5757576 | Above |
286390 | Acquisiton | 599.15464 | 8.000000 | 97.0000 | 74.00000 | 0.7628866 | Above |
286390 | Reversal | 525.93204 | 8.000000 | 103.0000 | 65.00000 | 0.6310680 | Above |
290813 | Acquisiton | 470.07563 | 10.000000 | 119.0000 | 68.00000 | 0.5714286 | Above |
290813 | Reversal | 394.25926 | 11.000000 | 81.0000 | 40.00000 | 0.4938272 | Below |
304250 | Acquisiton | 403.26923 | 8.000000 | 104.0000 | 93.00000 | 0.8942308 | Above |
304250 | Reversal | 394.18750 | 9.000000 | 96.0000 | 79.00000 | 0.8229167 | Above |
306384 | Acquisiton | 423.85981 | 10.000000 | 107.0000 | 70.00000 | 0.6542056 | Above |
306384 | Reversal | 336.88172 | 8.000000 | 93.0000 | 60.00000 | 0.6451613 | Above |
312870 | Acquisiton | 389.35165 | 8.000000 | 91.0000 | 71.00000 | 0.7802198 | Above |
312870 | Reversal | 383.38532 | 10.000000 | 109.0000 | 63.00000 | 0.5779817 | Above |
314824 | Acquisiton | 506.50980 | 9.000000 | 102.0000 | 77.00000 | 0.7549020 | Above |
314824 | Reversal | 437.40816 | 13.000000 | 98.0000 | 49.00000 | 0.5000000 | Above |
336228 | Acquisiton | 416.77381 | 8.000000 | 84.0000 | 52.00000 | 0.6190476 | Above |
336228 | Reversal | 408.75862 | 8.000000 | 116.0000 | 79.00000 | 0.6810345 | Above |
336606 | Acquisiton | 422.12281 | 10.000000 | 114.0000 | 69.00000 | 0.6052632 | Above |
336606 | Reversal | 328.09302 | 9.000000 | 86.0000 | 56.00000 | 0.6511628 | Above |
337901 | Acquisiton | 684.08911 | 9.000000 | 101.0000 | 76.00000 | 0.7524752 | Above |
337901 | Reversal | 560.80808 | 9.000000 | 99.0000 | 58.00000 | 0.5858586 | Above |
338154 | Acquisiton | 400.79798 | 9.000000 | 99.0000 | 79.00000 | 0.7979798 | Above |
338154 | Reversal | 379.46535 | 10.000000 | 101.0000 | 73.00000 | 0.7227723 | Above |
348065 | Acquisiton | 574.07000 | 10.000000 | 100.0000 | 68.00000 | 0.6800000 | Above |
348065 | Reversal | 474.62000 | 9.000000 | 100.0000 | 68.00000 | 0.6800000 | Above |
355611 | Acquisiton | 629.63636 | 10.000000 | 88.0000 | 53.00000 | 0.6022727 | Above |
355611 | Reversal | 507.41071 | 12.000000 | 112.0000 | 62.00000 | 0.5535714 | Above |
357086 | Acquisiton | 387.30631 | 8.000000 | 111.0000 | 81.00000 | 0.7297297 | Above |
357086 | Reversal | 358.57303 | 11.000000 | 89.0000 | 55.00000 | 0.6179775 | Above |
358678 | Acquisiton | 529.94898 | 9.000000 | 98.0000 | 66.00000 | 0.6734694 | Above |
358678 | Reversal | 462.84314 | 11.000000 | 102.0000 | 47.00000 | 0.4607843 | Below |
360071 | Acquisiton | 414.46512 | 9.000000 | 86.0000 | 49.00000 | 0.5697674 | Above |
360071 | Reversal | 301.95614 | 13.000000 | 114.0000 | 58.00000 | 0.5087719 | Above |
361956 | Acquisiton | 591.71296 | 8.000000 | 108.0000 | 89.00000 | 0.8240741 | Above |
361956 | Reversal | 533.22826 | 8.000000 | 92.0000 | 70.00000 | 0.7608696 | Above |
366568 | Acquisiton | 384.58947 | 8.000000 | 95.0000 | 67.00000 | 0.7052632 | Above |
366568 | Reversal | 378.27619 | 11.000000 | 105.0000 | 76.00000 | 0.7238095 | Above |
370064 | Acquisiton | 410.93617 | 8.000000 | 94.0000 | 64.00000 | 0.6808511 | Above |
370064 | Reversal | 408.66355 | 11.000000 | 107.0000 | 73.00000 | 0.6822430 | Above |
375251 | Acquisiton | 331.36893 | 10.000000 | 103.0000 | 53.00000 | 0.5145631 | Above |
375251 | Reversal | 229.73196 | 11.000000 | 97.0000 | 44.00000 | 0.4536082 | Below |
377598 | Acquisiton | 521.25532 | 9.000000 | 94.0000 | 56.00000 | 0.5957447 | Above |
377598 | Reversal | 426.79245 | 15.000000 | 106.0000 | 47.00000 | 0.4433962 | Below |
386521 | Acquisiton | 534.56044 | 9.000000 | 91.0000 | 62.00000 | 0.6813187 | Above |
386521 | Reversal | 483.99083 | 9.000000 | 109.0000 | 68.00000 | 0.6238532 | Above |
387074 | Acquisiton | 150.14943 | 9.000000 | 87.0000 | 55.00000 | 0.6321839 | Above |
387074 | Reversal | 106.45133 | 16.000000 | 113.0000 | 53.00000 | 0.4690265 | Below |
388748 | Acquisiton | 456.94681 | 8.000000 | 94.0000 | 64.00000 | 0.6808511 | Above |
388748 | Reversal | 386.58491 | 8.000000 | 106.0000 | 72.00000 | 0.6792453 | Above |
390664 | Acquisiton | 384.38542 | 8.000000 | 96.0000 | 79.00000 | 0.8229167 | Above |
390664 | Reversal | 369.68269 | 9.000000 | 104.0000 | 82.00000 | 0.7884615 | Above |
398563 | Acquisiton | 459.92079 | 8.000000 | 101.0000 | 76.00000 | 0.7524752 | Above |
398563 | Reversal | 409.33333 | 12.000000 | 99.0000 | 64.00000 | 0.6464646 | Above |
402292 | Acquisiton | 337.59341 | 9.000000 | 91.0000 | 60.00000 | 0.6593407 | Above |
402292 | Reversal | 352.40367 | 9.000000 | 109.0000 | 76.00000 | 0.6972477 | Above |
405983 | Acquisiton | 435.84270 | 8.000000 | 89.0000 | 59.00000 | 0.6629213 | Above |
405983 | Reversal | 419.80180 | 9.000000 | 111.0000 | 87.00000 | 0.7837838 | Above |
408928 | Acquisiton | 475.90265 | 9.000000 | 113.0000 | 72.00000 | 0.6371681 | Above |
408928 | Reversal | 524.21839 | 12.000000 | 87.0000 | 41.00000 | 0.4712644 | Below |
412911 | Acquisiton | 363.40351 | 9.000000 | 114.0000 | 75.00000 | 0.6578947 | Above |
412911 | Reversal | 346.39535 | 8.000000 | 86.0000 | 56.00000 | 0.6511628 | Above |
420484 | Acquisiton | 324.65957 | 14.000000 | 94.0000 | 44.00000 | 0.4680851 | Below |
420484 | Reversal | 272.19811 | 12.000000 | 106.0000 | 49.00000 | 0.4622642 | Below |
420599 | Acquisiton | 528.01087 | 9.000000 | 92.0000 | 66.00000 | 0.7173913 | Above |
420599 | Reversal | 478.63889 | 10.000000 | 108.0000 | 65.00000 | 0.6018519 | Above |
435236 | Acquisiton | 654.32955 | 14.000000 | 88.0000 | 43.00000 | 0.4886364 | Below |
435236 | Reversal | 448.51786 | 9.000000 | 112.0000 | 71.00000 | 0.6339286 | Above |
452318 | Acquisiton | 644.98230 | 10.000000 | 113.0000 | 65.00000 | 0.5752212 | Above |
452318 | Reversal | 611.17241 | 12.000000 | 87.0000 | 44.00000 | 0.5057471 | Above |
465801 | Acquisiton | 507.80734 | 8.000000 | 109.0000 | 91.00000 | 0.8348624 | Above |
465801 | Reversal | 426.87912 | 11.000000 | 91.0000 | 51.00000 | 0.5604396 | Above |
487469 | Acquisiton | 426.75000 | 12.000000 | 108.0000 | 57.00000 | 0.5277778 | Above |
487469 | Reversal | 337.85870 | 10.000000 | 92.0000 | 63.00000 | 0.6847826 | Above |
491818 | Acquisiton | 518.37255 | 8.000000 | 102.0000 | 79.00000 | 0.7745098 | Above |
491818 | Reversal | 432.91837 | 13.000000 | 98.0000 | 21.00000 | 0.2142857 | Below |
493897 | Acquisiton | 493.28431 | 12.000000 | 102.0000 | 63.00000 | 0.6176471 | Above |
493897 | Reversal | 507.97959 | 10.000000 | 98.0000 | 54.00000 | 0.5510204 | Above |
497282 | Acquisiton | 512.91589 | 8.000000 | 107.0000 | 54.00000 | 0.5046729 | Above |
497282 | Reversal | 420.73118 | 8.000000 | 93.0000 | 31.00000 | 0.3333333 | Below |
498100 | Acquisiton | 457.32110 | 9.000000 | 109.0000 | 81.00000 | 0.7431193 | Above |
498100 | Reversal | 432.24176 | 8.000000 | 91.0000 | 68.00000 | 0.7472527 | Above |
498431 | Acquisiton | 465.15966 | 10.000000 | 119.0000 | 70.00000 | 0.5882353 | Above |
498431 | Reversal | 432.90244 | 9.000000 | 82.0000 | 46.00000 | 0.5609756 | Above |
509575 | Acquisiton | 462.15741 | 8.000000 | 108.0000 | 90.00000 | 0.8333333 | Above |
509575 | Reversal | 432.71739 | 15.000000 | 92.0000 | 39.00000 | 0.4239130 | Below |
520216 | Acquisiton | 409.05208 | 8.000000 | 96.0000 | 77.00000 | 0.8020833 | Above |
520216 | Reversal | 326.49038 | 8.000000 | 104.0000 | 72.00000 | 0.6923077 | Above |
523645 | Acquisiton | 458.53153 | 8.000000 | 111.0000 | 95.00000 | 0.8558559 | Above |
523645 | Reversal | 447.01124 | 13.000000 | 89.0000 | 53.00000 | 0.5955056 | Above |
544168 | Acquisiton | 469.62500 | 8.000000 | 88.0000 | 59.00000 | 0.6704545 | Above |
544168 | Reversal | 430.51786 | 8.000000 | 112.0000 | 79.00000 | 0.7053571 | Above |
545599 | Acquisiton | 344.98990 | 11.000000 | 99.0000 | 57.00000 | 0.5757576 | Above |
545599 | Reversal | 291.19802 | 12.000000 | 101.0000 | 53.00000 | 0.5247525 | Above |
548715 | Acquisiton | 447.33684 | 8.000000 | 95.0000 | 68.00000 | 0.7157895 | Above |
548715 | Reversal | 449.07619 | 13.000000 | 105.0000 | 64.00000 | 0.6095238 | Above |
552946 | Acquisiton | 490.36538 | 9.000000 | 104.0000 | 75.00000 | 0.7211538 | Above |
552946 | Reversal | 450.15625 | 10.000000 | 96.0000 | 60.00000 | 0.6250000 | Above |
553816 | Acquisiton | 516.01010 | 9.000000 | 99.0000 | 69.00000 | 0.6969697 | Above |
553816 | Reversal | 431.65686 | 13.000000 | 102.0000 | 57.00000 | 0.5588235 | Above |
556363 | Acquisiton | 633.48113 | 10.000000 | 106.0000 | 88.00000 | 0.8301887 | Above |
556363 | Reversal | 526.92553 | 11.000000 | 94.0000 | 29.00000 | 0.3085106 | Below |
560811 | Acquisiton | 589.18447 | 11.000000 | 103.0000 | 63.00000 | 0.6116505 | Above |
560811 | Reversal | 490.90722 | 16.000000 | 97.0000 | 51.00000 | 0.5257732 | Above |
573484 | Acquisiton | 521.44538 | 8.000000 | 119.0000 | 93.00000 | 0.7815126 | Above |
573484 | Reversal | 508.01235 | 9.000000 | 81.0000 | 59.00000 | 0.7283951 | Above |
577910 | Acquisiton | 425.62162 | 9.000000 | 111.0000 | 77.00000 | 0.6936937 | Above |
577910 | Reversal | 393.15730 | 10.000000 | 89.0000 | 62.00000 | 0.6966292 | Above |
580733 | Acquisiton | 400.56604 | 9.000000 | 106.0000 | 74.00000 | 0.6981132 | Above |
580733 | Reversal | 362.50000 | 10.000000 | 94.0000 | 55.00000 | 0.5851064 | Above |
590730 | Acquisiton | 426.67857 | 8.000000 | 84.0000 | 52.00000 | 0.6190476 | Above |
590730 | Reversal | 404.82759 | 12.000000 | 116.0000 | 52.00000 | 0.4482759 | Below |
594829 | Acquisiton | 369.34545 | 11.000000 | 110.0000 | 55.00000 | 0.5000000 | Above |
594829 | Reversal | 179.46667 | 11.000000 | 90.0000 | 47.00000 | 0.5222222 | Above |
603203 | Acquisiton | 306.90909 | 10.000000 | 99.0000 | 52.00000 | 0.5252525 | Above |
603203 | Reversal | 212.76238 | 14.000000 | 101.0000 | 50.00000 | 0.4950495 | Below |
604188 | Acquisiton | 510.03158 | 8.000000 | 95.0000 | 76.00000 | 0.8000000 | Above |
604188 | Reversal | 501.83810 | 11.000000 | 105.0000 | 62.00000 | 0.5904762 | Above |
607615 | Acquisiton | 504.18812 | 9.000000 | 101.0000 | 86.00000 | 0.8514851 | Above |
607615 | Reversal | 442.04040 | 12.000000 | 99.0000 | 59.00000 | 0.5959596 | Above |
610487 | Acquisiton | 714.40909 | 9.000000 | 110.0000 | 70.00000 | 0.6363636 | Above |
610487 | Reversal | 520.14444 | 10.000000 | 90.0000 | 47.00000 | 0.5222222 | Above |
618099 | Acquisiton | 69.41584 | 11.000000 | 101.0000 | 55.00000 | 0.5445545 | Above |
618099 | Reversal | 101.91919 | 9.000000 | 99.0000 | 54.00000 | 0.5454545 | Above |
626588 | Acquisiton | 477.29592 | 8.000000 | 98.0000 | 65.00000 | 0.6632653 | Above |
626588 | Reversal | 443.18627 | 11.000000 | 102.0000 | 58.00000 | 0.5686275 | Above |
627043 | Acquisiton | 472.13889 | 8.000000 | 108.0000 | 81.00000 | 0.7500000 | Above |
627043 | Reversal | 453.81522 | 8.000000 | 92.0000 | 47.00000 | 0.5108696 | Above |
628645 | Acquisiton | 592.70330 | 8.000000 | 91.0000 | 68.00000 | 0.7472527 | Above |
628645 | Reversal | 532.21101 | 10.000000 | 109.0000 | 76.00000 | 0.6972477 | Above |
642086 | Acquisiton | 385.56190 | 8.000000 | 105.0000 | 94.00000 | 0.8952381 | Above |
642086 | Reversal | 374.34737 | 10.000000 | 95.0000 | 65.00000 | 0.6842105 | Above |
647687 | Acquisiton | 493.10377 | 8.000000 | 106.0000 | 79.00000 | 0.7452830 | Above |
647687 | Reversal | 506.51064 | 10.000000 | 94.0000 | 57.00000 | 0.6063830 | Above |
665918 | Acquisiton | 393.47170 | 8.000000 | 106.0000 | 94.00000 | 0.8867925 | Above |
665918 | Reversal | 383.95745 | 10.000000 | 94.0000 | 58.00000 | 0.6170213 | Above |
668126 | Acquisiton | 576.84043 | 9.000000 | 94.0000 | 62.00000 | 0.6595745 | Above |
668126 | Reversal | 529.76415 | 11.000000 | 106.0000 | 69.00000 | 0.6509434 | Above |
673855 | Acquisiton | 595.96875 | 9.000000 | 96.0000 | 61.00000 | 0.6354167 | Above |
673855 | Reversal | 558.74038 | 9.000000 | 104.0000 | 68.00000 | 0.6538462 | Above |
673865 | Acquisiton | 384.70093 | 9.000000 | 107.0000 | 70.00000 | 0.6542056 | Above |
673865 | Reversal | 382.03226 | 8.000000 | 93.0000 | 67.00000 | 0.7204301 | Above |
697366 | Acquisiton | 503.80233 | 12.000000 | 86.0000 | 44.00000 | 0.5116279 | Above |
697366 | Reversal | 385.82456 | 9.000000 | 114.0000 | 60.00000 | 0.5263158 | Above |
703805 | Acquisiton | 311.00000 | 8.000000 | 100.0000 | 73.00000 | 0.7300000 | Above |
703805 | Reversal | 263.23000 | 14.000000 | 100.0000 | 46.00000 | 0.4600000 | Below |
710889 | Acquisiton | 537.50495 | 12.000000 | 101.0000 | 62.00000 | 0.6138614 | Above |
710889 | Reversal | 492.06061 | 9.000000 | 99.0000 | 56.00000 | 0.5656566 | Above |
711091 | Acquisiton | 160.22973 | 12.000000 | 74.0000 | 39.00000 | 0.5270270 | Above |
711091 | Reversal | 208.18254 | 12.000000 | 126.0000 | 62.00000 | 0.4920635 | Below |
712497 | Acquisiton | 648.10588 | 8.000000 | 85.0000 | 54.00000 | 0.6352941 | Above |
712497 | Reversal | 477.90435 | 10.000000 | 115.0000 | 69.00000 | 0.6000000 | Above |
714201 | Acquisiton | 465.20619 | 8.000000 | 97.0000 | 75.00000 | 0.7731959 | Above |
714201 | Reversal | 458.79612 | 9.000000 | 103.0000 | 74.00000 | 0.7184466 | Above |
729490 | Acquisiton | 403.72414 | 8.000000 | 116.0000 | 91.00000 | 0.7844828 | Above |
729490 | Reversal | 392.66667 | 9.000000 | 84.0000 | 64.00000 | 0.7619048 | Above |
736478 | Acquisiton | 343.64444 | 9.000000 | 90.0000 | 63.00000 | 0.7000000 | Above |
736478 | Reversal | 252.21818 | 10.000000 | 110.0000 | 59.00000 | 0.5363636 | Above |
744735 | Acquisiton | 447.49495 | 10.000000 | 99.0000 | 61.00000 | 0.6161616 | Above |
744735 | Reversal | 407.97030 | 8.000000 | 101.0000 | 73.00000 | 0.7227723 | Above |
768782 | Acquisiton | 405.53398 | 8.000000 | 103.0000 | 78.00000 | 0.7572816 | Above |
768782 | Reversal | 379.30928 | 8.000000 | 97.0000 | 74.00000 | 0.7628866 | Above |
772265 | Acquisiton | 492.93694 | 9.000000 | 111.0000 | 83.00000 | 0.7477477 | Above |
772265 | Reversal | 441.43820 | 8.000000 | 89.0000 | 63.00000 | 0.7078652 | Above |
792241 | Acquisiton | 463.53153 | 9.000000 | 111.0000 | 78.00000 | 0.7027027 | Above |
792241 | Reversal | 419.93258 | 11.000000 | 89.0000 | 48.00000 | 0.5393258 | Above |
795092 | Acquisiton | 431.89535 | 8.000000 | 86.0000 | 68.00000 | 0.7906977 | Above |
795092 | Reversal | 411.59649 | 8.000000 | 114.0000 | 81.00000 | 0.7105263 | Above |
801097 | Acquisiton | 946.43689 | 8.000000 | 103.0000 | 72.00000 | 0.6990291 | Above |
801097 | Reversal | 948.00000 | 9.000000 | 97.0000 | 58.00000 | 0.5979381 | Above |
808746 | Acquisiton | 489.69474 | 8.000000 | 95.0000 | 76.00000 | 0.8000000 | Above |
808746 | Reversal | 484.16190 | 9.000000 | 105.0000 | 79.00000 | 0.7523810 | Above |
810684 | Acquisiton | 460.47664 | 9.000000 | 107.0000 | 73.00000 | 0.6822430 | Above |
810684 | Reversal | 454.90323 | 9.000000 | 93.0000 | 71.00000 | 0.7634409 | Above |
811078 | Acquisiton | 228.54206 | 11.000000 | 107.0000 | 52.00000 | 0.4859813 | Below |
811078 | Reversal | 218.12903 | 10.000000 | 93.0000 | 45.00000 | 0.4838710 | Below |
811594 | Acquisiton | 474.17347 | 8.000000 | 98.0000 | 90.00000 | 0.9183673 | Above |
811594 | Reversal | 445.32353 | 8.000000 | 102.0000 | 80.00000 | 0.7843137 | Above |
832332 | Acquisiton | 471.65625 | 8.000000 | 96.0000 | 78.00000 | 0.8125000 | Above |
832332 | Reversal | 449.51923 | 8.000000 | 104.0000 | 80.00000 | 0.7692308 | Above |
841921 | Acquisiton | 219.53704 | 9.000000 | 108.0000 | 59.00000 | 0.5462963 | Above |
841921 | Reversal | 175.29348 | 11.000000 | 92.0000 | 56.00000 | 0.6086957 | Above |
842916 | Acquisiton | 195.30233 | 10.000000 | 86.0000 | 44.00000 | 0.5116279 | Above |
842916 | Reversal | 107.42982 | 8.000000 | 114.0000 | 50.00000 | 0.4385965 | Below |
844579 | Acquisiton | 317.11224 | 10.000000 | 98.0000 | 48.00000 | 0.4897959 | Below |
844579 | Reversal | 288.72549 | 13.000000 | 102.0000 | 44.00000 | 0.4313725 | Below |
851572 | Acquisiton | 514.38710 | 8.000000 | 93.0000 | 60.00000 | 0.6451613 | Above |
851572 | Reversal | 424.31776 | 9.000000 | 107.0000 | 66.00000 | 0.6168224 | Above |
857452 | Acquisiton | 300.89247 | 8.000000 | 93.0000 | 58.00000 | 0.6236559 | Above |
857452 | Reversal | 293.85047 | 8.000000 | 107.0000 | 58.00000 | 0.5420561 | Above |
858150 | Acquisiton | 332.73469 | 10.000000 | 98.0000 | 59.00000 | 0.6020408 | Above |
858150 | Reversal | 198.69608 | 13.000000 | 102.0000 | 58.00000 | 0.5686275 | Above |
858936 | Acquisiton | 628.51376 | 8.000000 | 109.0000 | 86.00000 | 0.7889908 | Above |
858936 | Reversal | 618.60440 | 10.000000 | 91.0000 | 55.00000 | 0.6043956 | Above |
868336 | Acquisiton | 357.79808 | 11.000000 | 104.0000 | 55.00000 | 0.5288462 | Above |
868336 | Reversal | 286.89583 | 12.000000 | 96.0000 | 49.00000 | 0.5104167 | Above |
897077 | Acquisiton | 435.97849 | 8.000000 | 93.0000 | 77.00000 | 0.8279570 | Above |
897077 | Reversal | 385.54206 | 8.000000 | 107.0000 | 81.00000 | 0.7570093 | Above |
903284 | Acquisiton | 403.48936 | 8.000000 | 94.0000 | 79.00000 | 0.8404255 | Above |
903284 | Reversal | 398.01887 | 10.000000 | 106.0000 | 71.00000 | 0.6698113 | Above |
906532 | Acquisiton | 448.70588 | 9.000000 | 85.0000 | 62.00000 | 0.7294118 | Above |
906532 | Reversal | 416.56522 | 8.000000 | 115.0000 | 77.00000 | 0.6695652 | Above |
912677 | Acquisiton | 301.44762 | 10.000000 | 105.0000 | 69.00000 | 0.6571429 | Above |
912677 | Reversal | 237.21053 | 11.000000 | 95.0000 | 48.00000 | 0.5052632 | Above |
916675 | Acquisiton | 657.52439 | 11.000000 | 82.0000 | 40.00000 | 0.4878049 | Below |
916675 | Reversal | 631.32203 | 8.000000 | 118.0000 | 65.00000 | 0.5508475 | Above |
917515 | Acquisiton | 578.53191 | 10.000000 | 94.0000 | 56.00000 | 0.5957447 | Above |
917515 | Reversal | 472.92453 | 13.000000 | 106.0000 | 28.00000 | 0.2641509 | Below |
919986 | Acquisiton | 420.97980 | 9.000000 | 99.0000 | 64.00000 | 0.6464646 | Above |
919986 | Reversal | 375.57843 | 9.000000 | 102.0000 | 66.00000 | 0.6470588 | Above |
922923 | Acquisiton | 502.57447 | 10.000000 | 94.0000 | 64.00000 | 0.6808511 | Above |
922923 | Reversal | 491.57547 | 9.000000 | 106.0000 | 69.00000 | 0.6509434 | Above |
930043 | Acquisiton | 433.50000 | 8.000000 | 90.0000 | 73.00000 | 0.8111111 | Above |
930043 | Reversal | 430.70000 | 12.000000 | 110.0000 | 62.00000 | 0.5636364 | Above |
966645 | Acquisiton | 481.33000 | 8.000000 | 100.0000 | 68.00000 | 0.6800000 | Above |
966645 | Reversal | 449.36634 | 10.000000 | 101.0000 | 73.00000 | 0.7227723 | Above |
970528 | Acquisiton | 613.09615 | 9.000000 | 104.0000 | 57.00000 | 0.5480769 | Above |
970528 | Reversal | 622.93750 | 10.000000 | 96.0000 | 57.00000 | 0.5937500 | Above |
979443 | Acquisiton | 516.09375 | 9.000000 | 96.0000 | 68.00000 | 0.7083333 | Above |
979443 | Reversal | 461.45192 | 12.000000 | 104.0000 | 61.00000 | 0.5865385 | Above |
987189 | Acquisiton | 382.61165 | 9.000000 | 103.0000 | 71.00000 | 0.6893204 | Above |
987189 | Reversal | 365.23711 | 9.000000 | 97.0000 | 61.00000 | 0.6288660 | Above |
994811 | Acquisiton | 413.98876 | 9.000000 | 89.0000 | 62.00000 | 0.6966292 | Above |
994811 | Reversal | 398.59459 | 9.000000 | 111.0000 | 81.00000 | 0.7297297 | Above |
Means | 430.35475 | 9.712838 | 100.0203 | 64.11824 | 0.6409393 |
##N.B. For actual analysis, hang here and create drop_irregular function that prints summaries and has options to get rid of:
## bad subjects (those with < avg accuracy overall)
##bad blocks (blocks with <50% accuracy)
##bad trials (latency > 3000 - this should also encompass noresponse)
Figure 1. This chunk prints an overall view of reaction time.
rts <- list()
for (i in subjects) {
s <- reversal %>% dplyr::filter(subject == i)
rt_hist <- ggplot(s, aes(rt), stat = "bin") + geom_histogram() + ggtitle(i)
rts[[i]] <- rt_hist
}
rts[[length(rts) + 1]] <- rt_hist <- ggplot(reversal, aes(rt), stat = "bin") + geom_histogram() + ggtitle("Overall RTs")
summary(reversal$rt)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0 329.0 401.0 430.2 499.0 2000.0
for (i in subjects) {
d <- reversal %>% dplyr::filter(subject == i)
scatter <- ggplot(d, aes(x=trial_number, y = rightleftcorrect, color = as.factor(ResponseCorrect))) +
geom_point() +
geom_vline(aes(xintercept = reversal_trial, color = "Reversal Point")) +
scale_color_manual(labels = c("Incorrect", "Correct", "Reversal Point"),
values = (wes_palette("Cavalcanti1")[c(5,4,2)])) +
xlab("Trial Number") + ylab("Response Type") + ggtitle(i) +
facet_wrap(~block_number)
scatter[[i]] <- scatter
if (summary == "by_block_phase"){
h <- obj %>% filter(subject == i) %>% group_by(task_phase)
hist <- ggplot(h, aes(y=percent_correct, x = task_phase, fill = above_threshold)) +
geom_bar(stat = "identity") + scale_fill_manual(values = (wes_palette("Cavalcanti1")[c(4,5)])) + ylab("Percentage Correct") + xlab("") + facet_grid(~ block_number)
hist[[i]] <- hist
} else if (summary == "by_block"){
h <- obj %>% filter(subject == i) %>% group_by(block_number)
hist <- ggplot(h, aes(y=percent_correct, x = block_number, fill = above_threshold)) +
geom_bar(stat = "identity") + scale_fill_manual(values = (wes_palette("Cavalcanti1")[c(4,5)])) + ylab("Percentage Correct") + xlab("")
} else if (summary == "by_phase"){
h <- obj %>% filter(subject == i) %>% group_by(task_phase)
hist <- ggplot(h, aes(y=percent_correct, x = task_phase, fill = above_threshold)) +
geom_bar(stat = "identity") + scale_fill_manual(values = (wes_palette("Cavalcanti1")[c(4,5)])) + ylab("Percentage Correct") + xlab("")
}
plot_subjects[[i]] <- list(scatter, hist)
cowplot_list[[i]] <- local({
i <- cowplot <- cowplot::plot_grid(scatter, hist, nrow = 2)
})
}
## Warning: Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Warning: Removed 196 rows containing missing values (geom_vline).
## Warning: Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Warning: Removed 196 rows containing missing values (geom_vline).
## Warning: Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Warning: Removed 196 rows containing missing values (geom_vline).
## Warning: Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Warning: Removed 196 rows containing missing values (geom_vline).
## Warning: Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Warning: Removed 196 rows containing missing values (geom_vline).
## Warning: Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Warning: Removed 196 rows containing missing values (geom_vline).
## Warning: Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
## Removed 195 rows containing missing values (geom_vline).
template <- c(
"### Subject {{y}}\n",
"```{r, echo = FALSE}\n",
"cowplot_list[[{{y}}]] \n",
"```\n",
"\n"
)
plots <- lapply(1:length(cowplot_list), function(y) {knitr::knit_expand(text = template)})
a_1 <- aov(rt ~ task_phase, data = reversal)
summary(a_1)
## Df Sum Sq Mean Sq F value Pr(>F)
## task_phase 1 1.705e+07 17051011 296.1 <2e-16 ***
## Residuals 29604 1.705e+09 57590
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
a_1 <- aov(rt ~ block_number, data = reversal)
summary(a_1)
## Df Sum Sq Mean Sq F value Pr(>F)
## block_number 1 2.228e+07 22275171 388 <2e-16 ***
## Residuals 29604 1.700e+09 57413
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
rt_trialnum <- lm(rt ~ task_phase + as.numeric(block_number), data = reversal)
summary(rt_trialnum)
##
## Call:
## lm(formula = rt ~ task_phase + as.numeric(block_number), data = reversal)
##
## Residuals:
## Min 1Q Median 3Q Max
## -493.82 -109.82 -26.17 73.38 1633.33
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 513.4323 3.5484 144.69 <2e-16 ***
## task_phaseReversal -48.6996 2.7710 -17.57 <2e-16 ***
## as.numeric(block_number) -19.6116 0.9796 -20.02 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 238.4 on 29603 degrees of freedom
## Multiple R-squared: 0.02313, Adjusted R-squared: 0.02306
## F-statistic: 350.4 on 2 and 29603 DF, p-value: < 2.2e-16
emmeans(rt_trialnum, "task_phase")
## task_phase emmean SE df lower.CL upper.CL
## Acquisiton 455 1.96 29603 451 458
## Reversal 406 1.96 29603 402 410
##
## Confidence level used: 0.95
emmeans(rt_trialnum, "block_number")
## block_number emmean SE df lower.CL upper.CL
## 3 430 1.39 29603 428 433
##
## Results are averaged over the levels of: task_phase
## Confidence level used: 0.95
save(reversal, file = "~/github_repos/ReversalTask/data/reversal_proc.RData")
On average, 8 participants made the “correct” choice approximately 65% of the time, and made at least 10 correct choices by trial 10. Both of these outcomes participants are learning the task fine in 5 blocks of 40 trials.
SGP - it would make sense to add in a function which returns particularly bad blocks in terms of RT.
Reaction times averaged approximately 480 ms, which seems pretty good. There were also 5 trials with 0 latency, but it seems like this will inevitably be a feature of the task…
Issues for 9/23 appear addressed. Data is slated for collection the week of 10/11. Review Complete.
11 participants made the “correct” choice approximately 85% of the time, and made at least 10 correct choices by trial 12, on average. Both of these outcomes suggest the block length is working out well with 5 blocks of 40 trials.
SGP added an option at the top of the script to examine data by block, phase, or both. This will hopefully help to adjust views on data easily. it would make sense to add in a function which returns particularly bad blocks in terms of RT.
Average reaction times averaged approximately 200 ms, which is incredibly short. We should spend some time discussing the implications of this. There were also trials with 0 latency, which seems physically impossible.
A few critical concerns came up immediately: First, there are IDs that overlap. This was updated in the qualtrics survey, and luckily data was still distinguishable by time stamp. Second, one of those repeated subject did not complete the task fully (they bailed in the middle of the cannon task). - It’s unclear why, but this means I cannot pay this participant. They also only completed 40% of the surveys, indicating to me they were not going to receive payment anyway. Third, it seems the workerIDs were not recorded in the qualtrics survey. This has now been updated and will be testing this evening.
Overall, these graphs corroborate the idea that participants may be learning incredibly quickly. I worry that this means participants will reach a ceiling very fast, and we won’t see effects of block or learning over time. Adding an explicit instruction for participants to respond as quickly and accurately as possible did speed up the task considerably. Participant’s reaction times were fast - alarmingly fast. The average reaction time was 200ms, and there were trials where some participants had reaction times of 0. This seems problematic for analysis.
This next block is creating all variables I cannot record directly from inquisit for whatever reason (not recording at numeric, wrong block number, etc.). I worked to create as many variables as possible within the task structure, but there are still a few missing that I have to transform offline. 1. Confirm that final data is generating data that makes sense. 2. Generate vector of bad RTS and provide info on possible transforms. 3. Ensure that Qualtrics is not re-using IDs (lengthen randomID string). 4. add workerIds to embedded data so data can be matched across participants more easily.
On average, participants made the “correct” choice approximately 80% of the time, and made at least 10 correct choices by trial 17. Both of these outcomes suggest the block length can be shortened as suggested by MNH to as little as 50 trials. Regarding data verification and visualization, it will be important to look at RT data more explicitly in the larger sample. Based on the pilot, it looks like it could be handled pretty easily with a log or invesrse transform.
Task Recomendations - For Michael Discussion 1. Block length to 50 trials per MNH’s suggestion. Given subjects learned the contingencies in an average of 16 trials, this seems about correct. For time’s sake, I’m thinking of erring on the side of 4 blocks of 50 trials. 2. Explicitly instruct participants to click as quickly and accurately as possible, and shorten response windows such that the entire task will take between 8 and 10 minutes. See “Task Timing” for more details. https://docs.google.com/spreadsheets/d/1V2UD28C_zAfH90BnNO3si6c0-qDUDFbHoU44rfdEt4I/edit#gid=390744519 3. Combine stimulus selection and feedback phases, to save time? 4. Collect 10-15 subjects and check for final timing.
Data Check Plans 1. Translate dplyr operations into
usable functions and try to duplicate as little as possible across
tasks.
2. drop_irregular function 3. Check RTs and provide info on possible
transforms